package com.wly.datapool.tower
{
	public class TowerPool
	{
		private var _towerStaticArr:Array;
		static private var _instance:TowerPool;
		
		public function TowerPool()
		{
			_instance = this;
			init();
		}
		
		private function init():void
		{
			var tower:TowerStatic;
			_towerStaticArr = [];
			
			tower            = new TowerStatic;
			tower.level      = 1;
			tower.desc       = "测试用的炮塔";
			tower.speed      = 40;
			tower.modelClass = Tower0;
			tower.attackSound= Tower0Attack;
			tower.name       = "测试塔1";
			tower.createPrice= 100;
			tower.sellPrice  = 50;
			tower.attackArea = 100;
			tower.nextTower  = 1;
			tower.baseAttack = 20;
			_towerStaticArr.push(tower);
			
			tower            = new TowerStatic;
			tower.level      = 2;
			tower.desc       = "测试用的炮塔";
			tower.speed      = 40;
			tower.modelClass = Tower0;
			tower.attackSound= Tower0Attack;
			tower.name       = "测试塔2";
			tower.createPrice= 50;
			tower.sellPrice  = 75;
			tower.attackArea = 100;
			tower.baseAttack = 30;
			tower.nextTower  = 0;
			_towerStaticArr.push(tower);
		}
		
		static public function getInstance():TowerPool
		{
			return _instance;
		}
		
		public function getTowerByIndex(index:int):TowerStatic
		{
			return _towerStaticArr[index] as TowerStatic;
		}
		
		public function createTower(index:int):TowerInfo
		{
			var tower:TowerInfo = new TowerInfo(index);
			if(!tower.create())
			{
				return null;
			}
			return tower;
		}
	}
}